# print(list(range(1, 2021)))

# a = [1, 2, 3, 4, 5][::6]
# print(a)
       # 16 15 14 13 12 11 10 9 8 7 6
a = 0
def recursion(old_list):
    global a
    a += 1
    if len(old_list) > 1:
        new_list = old_list[::4]
        return recursion(new_list)
    else:
        return old_list

#print(recursion(list(range(1, 2021))))
#print(a)
import re
for num in range(1, 1000):
    if num % 3 == 0 and (re.search(r'[5]{2}', str(num))):
        print(num)
        print(re.search(r'[5]{2}', str(num)).group())
